package com.taotao.inventory.controller;

import java.util.List;
import java.io.IOException;

import com.taotao.inventory.domain.vo.PurchaseOrderVo;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.taotao.common.log.annotation.Log;
import com.taotao.common.log.enums.BusinessType;
import com.taotao.common.security.annotation.RequiresPermissions;
import com.taotao.inventory.domain.TProcurementDemand;
import com.taotao.inventory.service.ITProcurementDemandService;
import com.taotao.common.core.web.controller.BaseController;
import com.taotao.common.core.domain.Result;
import com.taotao.common.core.utils.poi.ExcelUtil;


/**
 * 采购需求表Controller
 *
 * @author lyl
 * @date 2025-01-14
 */
@RestController
@RequestMapping("/demand")
public class TProcurementDemandController extends BaseController
{
    @Autowired
    private ITProcurementDemandService tProcurementDemandService;

    /**
     * 查询采购需求表列表
     */
    @RequiresPermissions("inventory:demand:list")
    @GetMapping("/list")
    public Result list(TProcurementDemand tProcurementDemand)
    {
        startPage();
        List<TProcurementDemand> list = tProcurementDemandService.selectTProcurementDemandList(tProcurementDemand);
        return getDataTable(list);
    }



    /**
     * 采购需求表删除
     * @param id
     * @return
     */
    @RequiresPermissions("inventory:demand:remove")
    @DeleteMapping("/delete/{id}")
    public Result delete(@PathVariable("id") Long id)
    {
        return tProcurementDemandService.deleteTProcurementDemandById(id);
    }

    /**
     * 订单列表
     * @param purchaseOrderVo
     * @return
     */
    @RequiresPermissions("inventory:demand:list")
    @GetMapping("/purchaseOrderList")
    public Result purchaseOrderList(PurchaseOrderVo purchaseOrderVo)
    {
        startPage();

        List<PurchaseOrderVo> list = tProcurementDemandService.selectPurchaseOrderList(purchaseOrderVo
        );
        return getDataTable(list);
    }



}
